package com.example.bootdemo.listeners;

import com.alibaba.fastjson.JSON;
import com.example.bootdemo.events.UserRegisterEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class UserRegisterListener implements ApplicationListener<UserRegisterEvent> {

    Logger logger = LoggerFactory.getLogger(UserRegisterListener.class);
    @Override
    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {

        logger.info("用户已注册，完成给新注册用户发邮件业务逻辑......");
        //打赢用户信息
        logger.info("userInfo={}", JSON.toJSON(userRegisterEvent.getUserInfo()));

    }
}
